# -*- coding: utf8  -*-

import sys
import os

import gtk
import gtk.glade

from gui import save_backup
from gui import restore_backup

class TinyBackup:
	
	def __init__(self):
		builder = gtk.Builder()
                path = os.path.dirname(__file__) + os.sep + 'glade/TinyBackup.glade'
		builder.add_from_file(path)
		
		self.window = builder.get_object("TinyBackup")
		self.dlg_about = builder.get_object("dlg_about")
		
		builder.connect_signals(self)
	
	def on_TinyBackup_destroy(self, widget):
		gtk.main_quit()
	
	def on_btnAbout_clicked(self, widget):
		self.dlg_about.run()
		self.dlg_about.hide()
	
	def on_btnSave_clicked(self, widget):
		save = save_backup.SaveDialog(self.window)
		save.save_dialog.run()
	
	def on_btnRestore_clicked(self, widget):
		restore = restore_backup.RestoreDialog(self.window)
		restore.restore_dialog.run()
